package com.aaa.ssm.service.impl;

import com.aaa.ssm.dao.OperLogDao;
import com.aaa.ssm.entity.OperLog;
import com.aaa.ssm.service.OperLogService;
import com.aaa.ssm.util.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OperLogServiceImpl implements OperLogService {

    @Resource
    private OperLogDao operLogDao;

    /**
     * 分页查询
     * @param page
     * @return
     */
    @Override
    public PageInfo queryOperLog(Page<OperLog> page) {
        //设值页码和每页显示数量
        PageHelper.startPage(page.getPageNo(),page.getPageSize());
        //实例化pageinfo   把查询结果作为参数放入里面
        return new PageInfo(operLogDao.queryOperLog(page.getData()));

    }

    /**
     * 添加方法
     * @param log
     * @return
     */
    @Override
    public int OpeLog(OperLog log) {
        return operLogDao.OpeLog(log);
    }

    @Override
    public List<OperLog> annualQuery(String monthDay) {
        return operLogDao.annualQuery(monthDay);
    }

}
